<template>
    <view class="image-button" @click="handleClick">
        <image class="image" :src="image" />
        <slot />
    </view>
</template>

<script lang="ts" setup>
    const props = defineProps({
        image: {
            type: String,
            default: ''
        },
    })

    const emit = defineEmits(['click'])

    const handleClick = () => {
        emit('click')
    }
</script>

<style lang="less" scoped>
    .image-button {
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 0;

        .image {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
        }
    }
</style>
